par(mfrow=c(1,2))

stap=0.01;seq=seq(.005,.995,.01)

D1=dnorm(seq,0.40,0.04);D1=D1/(sum(D1)*stap)
D2=dnorm(seq,0.70,0.10);D2=D2/(sum(D2)*stap)
G1=(D1+D2)/2
G2=dnorm(seq,0.45,0.15);G2=G2/(sum(G2)*stap)
plot(seq,G1,col='blue',type='l',lwd=2,ylim=c(0,8),axes=FALSE,
main=c(paste('3A. Respondent Profiles for'),
paste('Group 1 (mean=.55) and Group 2 (mean=.45)'),
paste('Reference Cliffs Delta = .29')),
xlab='Probability of Behaviour',ylab='Plausibility')
axis(side=1,at=seq(0,1,0.10));axis(side=2,at=seq(0,8,2),las=1)
lines(seq,G2,col='red',lwd=2)
legend('topright',bty='n',cex=.9,
c('Respondent Profile Group 1','Respondent Profile Group 2'),
col=c('blue','red'),lty=c(1,1))

#########################################

OBCD_TOTAAL=read.table('OBCD_TOTAAL.txt')
OBCD_TOTAAL=as.matrix(OBCD_TOTAAL)
dim(OBCD_TOTAAL)=c(10000,39)

T1=numeric();T2=numeric()

for(x in 1:39)
{
t1=sort(OBCD_TOTAAL[,x])[9950]
T1=c(T1,t1)
}

for(x in 1:39)
{
t2=sort(OBCD_TOTAAL[,x])[51]
T2=c(T2,t2)
}

OBCD=apply(OBCD_TOTAAL,2,mean)
UPPER=T1
LOWER=T2
plot(c(seq(5,100,5),seq(110,200,10),seq(250,500,50),750,1000,2000),OBCD,
type='l',lwd=2,col='blue',axes=FALSE,ylim=c(-1,1),
main='3B. Original Observation-Based Cliffs Delta = .29',
xlab='Number of Observations per Group',
ylab='Observation-Based Cliffs Delta')
axis(side=1,at=c(5,seq(500,2000,500)))
axis(side=2,at=seq(-1,1,.2),las=1)
lines(c(0,2000),rep(0,2),col='black',lwd=1,lty=2)
lines(c(seq(5,100,5),seq(110,200,10),seq(250,500,50),750,1000,2000),UPPER,lty=2,col='blue')
lines(c(seq(5,100,5),seq(110,200,10),seq(250,500,50),750,1000,2000),LOWER,lty=2,col='blue')
legend('topright',bty='n',cex=.9,c('Estimated Observation-Based Cliffs Delta',
'99% Confidence Intervals'),col=c('blue','blue'),lty=c(1,2))



